using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Media.Animation;

namespace MindFactorial.LaunchPoint.Runtime
{
    /// <summary>
    /// Interaction logic for LaunchPointAlert.xaml
    /// </summary>
    public partial class LaunchPointAlert : System.Windows.Window
    {
        Storyboard _mouseLeave1;

        /// <summary>
        /// Creates a new alert
        /// </summary>
        public LaunchPointAlert()
        {
            InitializeComponent();
            this.Loaded += new RoutedEventHandler(LaunchPointAlert_Loaded);
            
        }

        void LaunchPointAlert_Loaded(object sender, RoutedEventArgs e)
        {
            this.MouseDown += new MouseButtonEventHandler(LaunchPointAlert_MouseDown);
            this.btnClose.Click += new RoutedEventHandler(btnClose_Click);
            _mouseLeave1 = (Storyboard)this.Resources["OnMouseLeave1"];
            _mouseLeave1.Completed += new EventHandler(sb_Completed);
            this.MouseEnter += new MouseEventHandler(LaunchPointAlert_MouseEnter);
            
        }

        void LaunchPointAlert_MouseEnter(object sender, MouseEventArgs e)
        {
            _mouseLeave1.Stop(this);
        }

        void sb_Completed(object sender, EventArgs e)
        {
            CloseDialog();
        }

        private void CloseDialog()
        {
            //this.DialogResult = true;
            this.Close();
        }

        void btnClose_Click(object sender, RoutedEventArgs e)
        {
            CloseDialog();
        }

        void LaunchPointAlert_MouseDown(object sender, MouseButtonEventArgs e)
        {
            this.DragMove();
        }

        /// <summary>
        /// displays a prompt
        /// </summary>
        /// <param name="Message"></param>
        public static void Show(string Message)
        {
            LaunchPointAlert alert = new LaunchPointAlert();
            alert.txtMessage.Text = Message;
            alert.ShowDialog();
        }

    }
}